import Home from '@/views/Home'
import NotFind from '@/views/NotFind.vue'
import Search from '@/views/Search'
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter) // VueRouter插件初始化

// 创建了一个路由对象 
const router = new VueRouter({
  routes: [
    // 重定向
    { path: '/', redirect: '/home' },
    { path: '/home', component: Home },
    { path: '/search/:words?', component: Search },
    { name:'search', path: '/search', component: Search },
    // 按顺序查找,最后写一个匹配所有来兜底
    {path:'*', component: NotFind}
  ]
})

export default router